package com.uuticketweb.ticket.flight.service;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.uuticketweb.ticket.db.HibernateUtils;
import com.uuticketweb.ticket.flight.dao.OrderDao;
import com.uuticketweb.ticket.pojos.Order;
import com.uuticketweb.ticket.pojos.OrderContact;
import com.uuticketweb.ticket.pojos.SimpleOrder;


public class OrderService {
	protected static Log logger = LogFactory.getLog(OrderService.class);
	
	private OrderDao orderDao;

	public void setOrderDao(OrderDao orderDao) {
		this.orderDao = orderDao;
	}
	
	public void savePojo(Object obj) throws Exception {
		HibernateUtils.save(obj);
	}
	public void updatePojo(Object obj) throws Exception {
		HibernateUtils.update(obj);
	}
	
	public Object getPojo(Serializable id, Class clazz) throws Exception {
		return HibernateUtils.get(id, clazz);
	}
	
	public void saveOrder(Order order) throws Exception {
		HibernateUtils.save(order);
	}
	
	public void updateOrder(Order order) throws Exception {
		HibernateUtils.update(order);
	}
	
	public void saveOrderContact(OrderContact orderContact) throws Exception {
		HibernateUtils.save(orderContact);
	}
	
	public void saveSimpleOrder(SimpleOrder simpleOrder) throws Exception {
		HibernateUtils.save(simpleOrder);
	}
	
	public List searchOrder(String tripKeyword, String guestKeyword, String orderNo, Date createdDate) {
		return orderDao.searchOrder(tripKeyword, guestKeyword, orderNo, createdDate);
	}
	
	public List searchSimpleOrder(String orderNo, String tripKeyword, Date createdDate) {
		return orderDao.searchSimpleOrder(orderNo, tripKeyword, createdDate);
	}
}
